package com.tj.ocr.img;

import java.awt.image.BufferedImage;

public class MyImage {
	private BufferedImage image;
	private int[][] data;
	private int[] data_line;
	private int width;
	private int height;
	private int fromx;
	private int fromy;
	
	public MyImage(BufferedImage image){
		this.setImage(image);
		this.width = image.getWidth();
		this.height = image.getHeight();
		this.data = new int[width][height];
		this.data_line = new int[height];
		this.fromx = 0;
		this.fromy = 0;
	}
	
	public MyImage(BufferedImage image, int[][] data){
		this.setImage(image);
		this.setData(data);
		this.width = image.getWidth();
		this.height = image.getHeight();
		this.fromx = 0;
		this.fromy = 0;
	}
	
	public MyImage(BufferedImage image, int[][] data, int fromx, int fromy, int width, int height){
		this.setImage(image);
		this.setData(data);
		this.width = width;
		this.height = height;
		this.fromx = fromx;
		this.fromy = fromy;
	}

	public BufferedImage getImage() {
		return image;
	}

	public void setImage(BufferedImage image) {
		this.image = image;
	}

	public int[][] getData() {
		return data;
	}

	public void setData(int[][] data) {
		this.data = data;
	}

	public int getWidth() {
		return width;
	}

	public void setWidth(int width) {
		this.width = width;
	}
	
	public int getHeight() {
		return height;
	}
	
	public void setHeight(int height) {
		this.height = height;
	}

	public int getFromx() {
		return fromx;
	}

	public void setFromx(int fromx) {
		this.fromx = fromx;
	}

	public int getFromy() {
		return fromy;
	}

	public void setFromy(int fromy) {
		this.fromy = fromy;
	}

	public BufferedImage realImage() {
		return this.image.getSubimage(fromx, fromy, width, height);
	}

	public int[] getData_line() {
		return data_line;
	}

	public void setData_line(int[] data_line) {
		this.data_line = data_line;
	}
}
